import { BaseModel } from '@/common/base/base.model';
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from 'typeorm';
import { AudioSynthesisModel } from '@/module/audio-synthesis/audio-synthesis.model';
import { EvaluationModel } from '@/module/evaluation/evaluation.model';
import { SimulationAlgoType } from 'common/utils/data';

@Entity('AUDIO_SYNTHESIS_EARBUDS2EARBUDS', {
  synchronize: false,
}) // 品牌
export class AudioSynthesisEarbuds2earbudsModel extends BaseModel {
  @Column({
    comment: '生成uuid',
    type: 'uuid',
  })
  audioSynthesisUuid: string;
  @OneToOne(() => AudioSynthesisModel, {
    createForeignKeyConstraints: false,
  })
  @JoinColumn({
    name: 'audio_synthesis_uuid',
    referencedColumnName: 'uuid',
  })
  audioSynthesis: AudioSynthesisModel;

  @Column({
    comment: '当前脉冲文件',
    type: 'varchar',
    length: 500,
    default: '',
  })
  currentImpulseResponseFile: string;

  @Column({
    comment: '目标脉冲文件',
    type: 'varchar',
    length: 500,
    default: '',
  })
  targetImpulseResponseFile: string;

  @Column({
    comment: '目标THD数据',
    type: 'varchar',
    length: 999999,
    default: '',
  })
  targetThdData: string;

  @Column({
    comment: '模拟算法',
    type: 'varchar',
    length: 50,
    default: SimulationAlgoType.TONING,
  })
  simulationAlgo: SimulationAlgoType;

  @Column({
    comment: '当前评测uuid',
    type: 'uuid',
    length: 500,
    nullable: true,
  })
  currentEvaluationUuid: string;
  @ManyToOne(() => EvaluationModel, {
    createForeignKeyConstraints: false,
  })
  @JoinColumn({
    name: 'current_evaluation_uuid',
    referencedColumnName: 'uuid',
  })
  currentEvaluation: EvaluationModel;

  @Column({
    comment: '目标评测uuid',
    type: 'uuid',
    length: 500,
    nullable: true,
  })
  targetEvaluationUuid: string;
  @ManyToOne(() => EvaluationModel, {
    createForeignKeyConstraints: false,
  })
  @JoinColumn({
    name: 'target_evaluation_uuid',
    referencedColumnName: 'uuid',
  })
  targetEvaluation: EvaluationModel;
}
